<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <ul class="nav">
    <li>我的首页</li>
    <li>产品介绍</li>
    <li>联系方式</li>
  </ul>
  <script>
    const data = [
      {
        src: './uploads/goods1.png',
        title: 'KN95级莫兰迪色防护口罩',
        num: 79
      },
      {
        src: './uploads/goods2.png',
        title: '紫檀外独板三层普洱茶盒',
        num: 566
      },
      {
        src: './uploads/goods3.png',
        title: '法拉蒙高颜值记事本可定制',
        num: 58
      },
      // {
      //   src: './uploads/goods4.png',
      //   title: '科技布布艺沙发',
      //   num: 3579
      // },
    ]
    // const li = document.querySelector('.nav')
    const li = document.querySelectorAll('.nav li')
    for (let j = 0; j < li.length; j++) {
      console.log(li[j].innerHTML);
      li[j].innerHTML = data[j].title
    }
    // for (let i = 0; i < data.length; i++) {
    //   console.log(data[i].title);
    //   li[j].innerHTML=data[i].title
    // }

  </script>
</body>

</html>